﻿@model IEnumerable<KRM.Core.vGrouponVoucher>

@{
    ViewBag.Title = "Manage  Groupon Vouchers";
    Layout = "/Views/Shared/_PopupLayout.cshtml";
    var value = ViewBag.value;
    int type=0;
    if (value == (decimal)3.8)
    {
        type = 1;
    }
    if (value == (decimal)5.45)
    {
        type = 2;
    }
    if (value == (decimal)7.07)
    {
        type = 3;
    }
}

<div style="padding:10px">
    <div class="box">
        <div class="row-fluid" id="ImportGrouponVoucher-MessageResult">
                @Html.Partial("Partial/_MessageResult")
        </div>
        <div class="row-fluid">
            <form action="/voucher/ImportManageGrouponVoucher" method="POST" class="left form-inline nomargin"enctype="multipart/form-data">
                <div class="row-fluid">
                    <div class="span1">
                        <label>Type</label>
                    </div>
                    <div class="span2">
                        <select name="Type" id="GrouponVoucherType"  onchange="ChangeGrouponOrderValue(this.value)" style="width:95%">
                            <option value="0"@(type==0? "selected=selected":"") >All</option>
                            <option value="1"@(type==1? "selected=selected":"")>1 x set of 24</option>
                            <option value="2"@(type==2? "selected=selected":"")>2 x set of 24</option>
                            <option value="3"@(type==3? "selected=selected":"")>3 x set of 24</option>
                        </select>
                    </div> 
                    <div class="span1">
                        <label>Value(&pound;)</label>
                    </div> 
                   
                    <div class="span2">
                        <input type="text" value="@value"  id="GrouponOrderValue" name="value" style="width:95%" />
                    </div> 
                    <div class="span2">
                        <a href="/voucher/ManageGrouponVouchers?value=@value"class="btn btn-primary" id="btnRefeshManageGrouponVouchers">
                            <i class="icon-refresh"></i> Refresh
                        </a>
                        
                    </div> 
                    <div class="span2">
                        <input id="FileImport" name="FileImport" type="file" style="width:95%" />
                    </div> 
                    <div class="span2">
                    <button type="submit" class="btn btn-primary">
                            <i class="icon-plus-sign-alt"></i>
                            Import
                        </button>
                    </div>
                    
                </div>

            </form>
        </div>

        <div class="row-fluid">
            <div class="row-fluid text-right">
                <a href="/voucher/ExportGrouponVouchersToExcel?value=@value" id ="btnExportGrouponVouchersToExcel"class="btn" style="padding: 0 ;max-height: 30px">
                    <img src="/img/icon-exel.png" style="max-height: 30px"/>
                </a>
            </div>
            <div class="row-fluid">
                <table class="table table-hover table-bordered table-fix dataTable">
                    <thead>
                        <tr>
                            <th>VoucherCode</th>
                            <th>Security Code</th>
                            <th>OrderRef</th>
                            <th>Groupon Order Value</th>
                            <th>Value</th>
                        </tr>
                    </thead>
                    <tbody>
                        @foreach (var item in Model)
                        {
                            <tr>
                                <td style="text-align: center">@item.VoucherCode</td>
                                <td style="text-align: center"> @item.GrouponSecurityCode</td>
                                <td style="text-align: center">@item.OrderRef</td>
                                <td style="text-align: center"> @item.GrouponOrderValue</td>
                                <td style="text-align: center">@item.Value</td>
                            </tr>
                        }
                    </tbody>
                </table>
             
            </div>
        </div>
    </div>
</div>


